#include <amxmodx>
#include <fakemeta_util>
#include <rpgx>

new upgrade_id;

public plugin_init(){
	register_plugin("SpeedShoot+ RPGx Upgrade", "2.1", "roflmao456");
	register_forward(FM_PlayerPreThink, "client_PreThink");
	}

public RPGx_OnPluginReady()
	upgrade_id = RPGx_MakeUpgrade("SpeedShoot+", 5, 15, 20);

public client_PreThink(id){
	new level = RPGx_GetUpgradeLevel(id, upgrade_id);
	if(level){
		new weaponid = get_user_weapon(id);
		if(weaponid){
			new weapon[32];
			get_weaponname(weaponid, weapon, 31);
			new ent = fm_find_ent_by_owner(-1, weapon, id);
			if(ent){
				new Float:nextattack = get_pdata_float(ent, 46, 4);
				if(nextattack > 0.0)
					set_pdata_float(ent, 46, nextattack - (nextattack * (level * 0.05)), 4);
				}
			}
		}
	}